{% extends "base.html" %}
{% block content %}
<div class="leaderboard well">
    {% if g.user.username %}
	    <h1>{{g.user.username}},欢迎来到爷的博客!</h1>
    {% else %}
        <h1>欢迎来到爷的博客!</h1>
    {% endif %}
</div>
{% include 'flash.html' %}
{% for post in posts.items %}
<h2 class="post-title">
	<a href="{{ url_for('detail',index=post.id)}}">{{ post.title }}</a>
</h2>
<p class="post-meta">
    <p>
        <strong>
           <span>作者:{{ post.author.username }}</span>
           <span>时间:{{ post.time}} </span>
        </strong>
    </p>
</p>
<div class="post-description">
<p>
     {{ post.content| truncate(10,True) }}
</p>
</div>
<a href="{{ url_for('detail',index=post.id)}}" class="pure-button">点开阅读更多 >>> </a>
<hr>
{% endfor %}
<ul class="pager">
   {% if posts.has_prev %}
   	 <li class="previous"><a href="{{ url_for('index', page = posts.prev_num) }}">上一页</a></li>
    {% else %}
    	<li class="previous disabled"><a href="#">上一页</a></li>
    {% endif %}
    {% if posts.has_next %}
    	<li class="next"><a href="{{ url_for('index', page = posts.next_num) }}">下一页</a></li>
    {% else %}
    	<li class="next disabled"><a href="#">下一页</a></li>
    {% endif %}
</ul>
{% endblock %}
